﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TANKWAR_alpha
{
    class Bullet:ObjElement
    {
         public Bullet(double left,double  top,int ty,MoveDirection dir,GameGDI _gameGDI)
        {
            this.Left = left;
            this.Top = top;
            this.Width = Constant.bombWidth;
            this.Height = Constant.bombHeight;
            this.Type = ty;                                     //enemy:1   player:0
            this.Life = true;
            this.Speed = Constant .BulletSpeed;
            this.Direction = dir;                             //mark the direction of bomb
            this.GameDriver = _gameGDI;
        }

        public void BulletMove()
         {
            switch (this.Direction)
            {
                case MoveDirection.UP: this.Top -= this.Speed; break;
                case MoveDirection.DOWN: this.Top += this.Speed; break;
                case MoveDirection.LEFT: this.Left -= this.Speed; break;
                case MoveDirection.RIGHT: this.Left += this.Speed; break;
                default: break;
            }
         }
          
    }
}
